<?php
require_once 'models/models_hotro.php';
$mod = $_GET['mod'];
$obht = new models_hotro();	
switch ($mod){
	case 'hotro':{
		$data['list'] = $obht->_listhotro();
		//echo var_dump($data);
		require_once 'views/admin/hotro/index.php';
		break;
	}
	case 'addhotro':{
		if($_POST)
		{
			$obht->_addhotro($_POST['nick'], $_POST['ten'], $_POST['anhien']);
			echo '<script> window.location.href="admin.php?mod=hotro"</script>';
		}
		require 'views/admin/hotro/add.php';
		break;
	}
	case 'delhotro':{
		$obht->_delhotro($_GET['ma']);
		echo '<script>window.location.href="admin.php?mod=hotro"</script>';
		break;
	}
	case 'updatehotro':{
		if($_POST){
			$obht->_updatehotro($_POST['nick'], $_POST['ten'], $_POST['anhien'], $_GET['ma']);
			echo '<script>window.location.href="admin.php?mod=hotro"</script>';
		}
		$data = $obht->_gethotro($_GET['ma']);
		require 'views/admin/hotro/edit.php';
		break;
	}
	default: {echo  'Yeu cau chua duoc xu ly !'; break;}
	}
?>